﻿using System;
namespace Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="KohustisOtsing", Namespace="http://producers.etoimik.xtee.riik.ee/producer/etoimik", Target=typeof(KohustisOtsing))]
    public class KohustisOtsingSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IKohustisOtsing clazz;
        
        public KohustisOtsingSerializer(IKohustisOtsing clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            if (clazz.MenetluseNR!=null) {
                Writer.WriteStartElement("MenetluseNR");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.MenetluseNR))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.MenetluseObjektID!=null) {
                Writer.WriteStartElement("MenetluseObjektID");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.MenetluseObjektID))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.TyypKL!=null) {
                Writer.WriteStartElement("TyypKL");
                Writer.WriteTypeAttribute("http://schemas.xmlsoap.org/soap/encoding/", "Array");
                Writer.WriteArrayTypeAttribute("long", "http://www.w3.org/2001/XMLSchema", clazz.TyypKL.Count);
                for (int x = 0; ((clazz.TyypKL != null) 
                            && (x < clazz.TyypKL.Count)); x = (x + 1)) {
                    if (clazz.TyypKL[x]!=null) {
                        Writer.WriteStartElement("item");
                        Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                        Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.TyypKL[x]))).ToString());
                        Writer.WriteEndElement();
                    }
                }
                Writer.WriteEndElement();
            }
            if (clazz.LiikKL!=null) {
                Writer.WriteStartElement("LiikKL");
                Writer.WriteTypeAttribute("http://schemas.xmlsoap.org/soap/encoding/", "Array");
                Writer.WriteArrayTypeAttribute("long", "http://www.w3.org/2001/XMLSchema", clazz.LiikKL.Count);
                for (int x = 0; ((clazz.LiikKL != null) 
                            && (x < clazz.LiikKL.Count)); x = (x + 1)) {
                    if (clazz.LiikKL[x]!=null) {
                        Writer.WriteStartElement("item");
                        Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                        Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.LiikKL[x]))).ToString());
                        Writer.WriteEndElement();
                    }
                }
                Writer.WriteEndElement();
            }
            if (clazz.AlaLiikKL!=null) {
                Writer.WriteStartElement("AlaLiikKL");
                Writer.WriteTypeAttribute("http://schemas.xmlsoap.org/soap/encoding/", "Array");
                Writer.WriteArrayTypeAttribute("long", "http://www.w3.org/2001/XMLSchema", clazz.AlaLiikKL.Count);
                for (int x = 0; ((clazz.AlaLiikKL != null) 
                            && (x < clazz.AlaLiikKL.Count)); x = (x + 1)) {
                    if (clazz.AlaLiikKL[x]!=null) {
                        Writer.WriteStartElement("item");
                        Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                        Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.AlaLiikKL[x]))).ToString());
                        Writer.WriteEndElement();
                    }
                }
                Writer.WriteEndElement();
            }
            if (clazz.AlgusKP!=null) {
                Writer.WriteStartElement("AlgusKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.AlgusKP))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.AlgusKPVahemikuLoppKP!=null) {
                Writer.WriteStartElement("AlgusKPVahemikuLoppKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.AlgusKPVahemikuLoppKP))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.LoppKP!=null) {
                Writer.WriteStartElement("LoppKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.LoppKP))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.RakendumiseAlgusKP!=null) {
                Writer.WriteStartElement("RakendumiseAlgusKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.RakendumiseAlgusKP))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.RakendumiseAlgusKPVahemikuLoppKP!=null) {
                Writer.WriteStartElement("RakendumiseAlgusKPVahemikuLoppKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.RakendumiseAlgusKPVahemikuLoppKP))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.RakendamiseTahtaegKP!=null) {
                Writer.WriteStartElement("RakendamiseTahtaegKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.RakendamiseTahtaegKP))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.RakendamiseTahtaegKPVahemikuLoppKP!=null) {
                Writer.WriteStartElement("RakendamiseTahtaegKPVahemikuLoppKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.RakendamiseTahtaegKPVahemikuLoppKP))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.RakendumiseLoppKP!=null) {
                Writer.WriteStartElement("RakendumiseLoppKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.RakendumiseLoppKP))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.RakendumiseLoppKPVahemikuLoppKP!=null) {
                Writer.WriteStartElement("RakendumiseLoppKPVahemikuLoppKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.RakendumiseLoppKPVahemikuLoppKP))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.IsikuKood!=null) {
                Writer.WriteStartElement("IsikuKood");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IsikuKood))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.IsikuNimi!=null) {
                Writer.WriteStartElement("IsikuNimi");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IsikuNimi))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.IsikuEesnimi!=null) {
                Writer.WriteStartElement("IsikuEesnimi");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IsikuEesnimi))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.IsikuKoosnimi!=null) {
                Writer.WriteStartElement("IsikuKoosnimi");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IsikuKoosnimi))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.IsikuVanusMaaramisel!=null) {
                Writer.WriteStartElement("IsikuVanusMaaramisel");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "int");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdInt(((int)(clazz.IsikuVanusMaaramisel))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.IsikuVanusMaaramiselVahemikuLoppVanus!=null) {
                Writer.WriteStartElement("IsikuVanusMaaramiselVahemikuLoppVanus");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "int");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdInt(((int)(clazz.IsikuVanusMaaramiselVahemikuLoppVanus))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.SeisundKL!=null) {
                Writer.WriteStartElement("SeisundKL");
                Writer.WriteTypeAttribute("http://schemas.xmlsoap.org/soap/encoding/", "Array");
                Writer.WriteArrayTypeAttribute("long", "http://www.w3.org/2001/XMLSchema", clazz.SeisundKL.Count);
                for (int x = 0; ((clazz.SeisundKL != null) 
                            && (x < clazz.SeisundKL.Count)); x = (x + 1)) {
                    if (clazz.SeisundKL[x]!=null) {
                        Writer.WriteStartElement("item");
                        Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                        Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.SeisundKL[x]))).ToString());
                        Writer.WriteEndElement();
                    }
                }
                Writer.WriteEndElement();
            }
            if (clazz.SeisundKP!=null) {
                Writer.WriteStartElement("SeisundKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.SeisundKP))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.LoppKPIsNull!=null) {
                Writer.WriteStartElement("LoppKPIsNull");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "boolean");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdBoolean(((bool)(clazz.LoppKPIsNull))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.RakendumiseLoppKPIsNull!=null) {
                Writer.WriteStartElement("RakendumiseLoppKPIsNull");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "boolean");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdBoolean(((bool)(clazz.RakendumiseLoppKPIsNull))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.OsaliseObjektID!=null) {
                Writer.WriteStartElement("OsaliseObjektID");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.OsaliseObjektID))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.IsikuObjektID!=null) {
                Writer.WriteStartElement("IsikuObjektID");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.IsikuObjektID))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.ObjektID!=null) {
                Writer.WriteStartElement("ObjektID");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.ObjektID))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.MoistetudSumma!=null) {
                Writer.WriteStartElement("MoistetudSumma");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "decimal");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDecimal(((decimal)(clazz.MoistetudSumma))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.MoistetudSummaValuutaKL!=null) {
                Writer.WriteStartElement("MoistetudSummaValuutaKL");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.MoistetudSummaValuutaKL))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.TasutudSumma!=null) {
                Writer.WriteStartElement("TasutudSumma");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "decimal");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDecimal(((decimal)(clazz.TasutudSumma))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.TasutudSummaValuutaKL!=null) {
                Writer.WriteStartElement("TasutudSummaValuutaKL");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.TasutudSummaValuutaKL))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Taidetud!=null) {
                Writer.WriteStartElement("Taidetud");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "boolean");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdBoolean(((bool)(clazz.Taidetud))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.TaitmiseTapsustusKL!=null) {
                Writer.WriteStartElement("TaitmiseTapsustusKL");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.TaitmiseTapsustusKL))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.VoibKandaOsiti!=null) {
                Writer.WriteStartElement("VoibKandaOsiti");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "boolean");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdBoolean(((bool)(clazz.VoibKandaOsiti))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.GruppKL!=null) {
                Writer.WriteStartElement("GruppKL");
                Writer.WriteTypeAttribute("http://schemas.xmlsoap.org/soap/encoding/", "Array");
                Writer.WriteArrayTypeAttribute("long", "http://www.w3.org/2001/XMLSchema", clazz.GruppKL.Count);
                for (int x = 0; ((clazz.GruppKL != null) 
                            && (x < clazz.GruppKL.Count)); x = (x + 1)) {
                    if (clazz.GruppKL[x]!=null) {
                        Writer.WriteStartElement("item");
                        Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                        Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.GruppKL[x]))).ToString());
                        Writer.WriteEndElement();
                    }
                }
                Writer.WriteEndElement();
            }
            if (clazz.IsikudSolidaarselt!=null) {
                Writer.WriteStartElement("IsikudSolidaarselt");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "boolean");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdBoolean(((bool)(clazz.IsikudSolidaarselt))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.NoueObjektID!=null) {
                Writer.WriteStartElement("NoueObjektID");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.NoueObjektID))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.MakseRekvisiidid!=null) {
                Writer.WriteStartElement("MakseRekvisiidid");
                Writer.WriteTypeAttribute("http://schemas.xmlsoap.org/soap/encoding/", "Array");
                Writer.WriteArrayTypeAttribute("MakseRekvisiidid", "http://producers.etoimik.xtee.riik.ee/producer/etoimik", clazz.MakseRekvisiidid.Count);
                for (int x = 0; ((clazz.MakseRekvisiidid != null) 
                            && (x < clazz.MakseRekvisiidid.Count)); x = (x + 1)) {
                    if (clazz.MakseRekvisiidid[x]!=null) {
                        Writer.WriteStartElement("item");
                        global::Xtee.Core.SerializationMetadata metaMakseRekvisiidid = this.GetMetaData(clazz.MakseRekvisiidid[x]);
                        Writer.WriteTypeAttribute(metaMakseRekvisiidid.TypeQualifiedName.Namespace, metaMakseRekvisiidid.TypeQualifiedName.Name);
                        metaMakseRekvisiidid.NewSerializer(clazz.MakseRekvisiidid[x]).WriteXml(Writer);
                        Writer.WriteEndElement();
                    }
                }
                Writer.WriteEndElement();
            }
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="MenetluseNR") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.MenetluseNR = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("MenetluseNR")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="MenetluseObjektID") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>KohustisOtsing>MenetluseObjektID");
                }
                clazz.MenetluseObjektID = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("MenetluseObjektID")).Value;
            }
            if (Reader.LocalName=="TyypKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.TyypKL = new System.Collections.Generic.List<System.Int64?>();
                    if ((Reader.IsEmptyElement == false)) {
                        Reader.ReadStartElement("TyypKL");
                        for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                                    && (Reader.LocalName == "item")); ) {
                            if (Reader.IsElementNil()) {
                                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>KohustisOtsing>TyypKL>item");
                            }
                            clazz.TyypKL.Add(new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("item")).Value);
                        }
                        Reader.ReadEndElement();
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="LiikKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.LiikKL = new System.Collections.Generic.List<System.Int64?>();
                    if ((Reader.IsEmptyElement == false)) {
                        Reader.ReadStartElement("LiikKL");
                        for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                                    && (Reader.LocalName == "item")); ) {
                            if (Reader.IsElementNil()) {
                                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>KohustisOtsing>LiikKL>item");
                            }
                            clazz.LiikKL.Add(new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("item")).Value);
                        }
                        Reader.ReadEndElement();
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="AlaLiikKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.AlaLiikKL = new System.Collections.Generic.List<System.Int64?>();
                    if ((Reader.IsEmptyElement == false)) {
                        Reader.ReadStartElement("AlaLiikKL");
                        for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                                    && (Reader.LocalName == "item")); ) {
                            if (Reader.IsElementNil()) {
                                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>KohustisOtsing>AlaLiikKL>item");
                            }
                            clazz.AlaLiikKL.Add(new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("item")).Value);
                        }
                        Reader.ReadEndElement();
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="AlgusKP") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.AlgusKP = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("AlgusKP")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="AlgusKPVahemikuLoppKP") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.AlgusKPVahemikuLoppKP = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("AlgusKPVahemikuLoppKP")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="LoppKP") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.LoppKP = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("LoppKP")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="RakendumiseAlgusKP") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.RakendumiseAlgusKP = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("RakendumiseAlgusKP")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="RakendumiseAlgusKPVahemikuLoppKP") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.RakendumiseAlgusKPVahemikuLoppKP = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("RakendumiseAlgusKPVahemikuLoppKP")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="RakendamiseTahtaegKP") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.RakendamiseTahtaegKP = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("RakendamiseTahtaegKP")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="RakendamiseTahtaegKPVahemikuLoppKP") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.RakendamiseTahtaegKPVahemikuLoppKP = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("RakendamiseTahtaegKPVahemikuLoppKP")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="RakendumiseLoppKP") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.RakendumiseLoppKP = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("RakendumiseLoppKP")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="RakendumiseLoppKPVahemikuLoppKP") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.RakendumiseLoppKPVahemikuLoppKP = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("RakendumiseLoppKPVahemikuLoppKP")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="IsikuKood") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.IsikuKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("IsikuKood")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="IsikuNimi") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.IsikuNimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("IsikuNimi")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="IsikuEesnimi") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.IsikuEesnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("IsikuEesnimi")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="IsikuKoosnimi") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.IsikuKoosnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("IsikuKoosnimi")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="IsikuVanusMaaramisel") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>KohustisOtsing>IsikuVanusMaaramisel");
                }
                clazz.IsikuVanusMaaramisel = new global::Xtee.Core.Schema.XsdInt(Reader.ReadElementString("IsikuVanusMaaramisel")).Value;
            }
            if (Reader.LocalName=="IsikuVanusMaaramiselVahemikuLoppVanus") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>KohustisOtsing>IsikuVanusMaaramiselVahemikuLoppVanus");
                }
                clazz.IsikuVanusMaaramiselVahemikuLoppVanus = new global::Xtee.Core.Schema.XsdInt(Reader.ReadElementString("IsikuVanusMaaramiselVahemikuLoppVanus")).Value;
            }
            if (Reader.LocalName=="SeisundKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.SeisundKL = new System.Collections.Generic.List<System.Int64?>();
                    if ((Reader.IsEmptyElement == false)) {
                        Reader.ReadStartElement("SeisundKL");
                        for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                                    && (Reader.LocalName == "item")); ) {
                            if (Reader.IsElementNil()) {
                                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>KohustisOtsing>SeisundKL>item");
                            }
                            clazz.SeisundKL.Add(new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("item")).Value);
                        }
                        Reader.ReadEndElement();
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="SeisundKP") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.SeisundKP = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("SeisundKP")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="LoppKPIsNull") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.LoppKPIsNull = new global::Xtee.Core.Schema.XsdBoolean(Reader.ReadElementString("LoppKPIsNull")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="RakendumiseLoppKPIsNull") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.RakendumiseLoppKPIsNull = new global::Xtee.Core.Schema.XsdBoolean(Reader.ReadElementString("RakendumiseLoppKPIsNull")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="OsaliseObjektID") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.OsaliseObjektID = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("OsaliseObjektID")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="IsikuObjektID") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.IsikuObjektID = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("IsikuObjektID")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="ObjektID") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.ObjektID = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("ObjektID")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="MoistetudSumma") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.MoistetudSumma = new global::Xtee.Core.Schema.XsdDecimal(Reader.ReadElementString("MoistetudSumma")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="MoistetudSummaValuutaKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.MoistetudSummaValuutaKL = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("MoistetudSummaValuutaKL")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="TasutudSumma") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.TasutudSumma = new global::Xtee.Core.Schema.XsdDecimal(Reader.ReadElementString("TasutudSumma")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="TasutudSummaValuutaKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.TasutudSummaValuutaKL = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("TasutudSummaValuutaKL")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Taidetud") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Taidetud = new global::Xtee.Core.Schema.XsdBoolean(Reader.ReadElementString("Taidetud")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="TaitmiseTapsustusKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.TaitmiseTapsustusKL = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("TaitmiseTapsustusKL")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="VoibKandaOsiti") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.VoibKandaOsiti = new global::Xtee.Core.Schema.XsdBoolean(Reader.ReadElementString("VoibKandaOsiti")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="GruppKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.GruppKL = new System.Collections.Generic.List<System.Int64?>();
                    if ((Reader.IsEmptyElement == false)) {
                        Reader.ReadStartElement("GruppKL");
                        for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                                    && (Reader.LocalName == "item")); ) {
                            if (Reader.IsElementNil()) {
                                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>KohustisOtsing>GruppKL>item");
                            }
                            clazz.GruppKL.Add(new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("item")).Value);
                        }
                        Reader.ReadEndElement();
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="IsikudSolidaarselt") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>KohustisOtsing>IsikudSolidaarselt");
                }
                clazz.IsikudSolidaarselt = new global::Xtee.Core.Schema.XsdBoolean(Reader.ReadElementString("IsikudSolidaarselt")).Value;
            }
            if (Reader.LocalName=="NoueObjektID") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.NoueObjektID = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("NoueObjektID")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="MakseRekvisiidid") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.MakseRekvisiidid = new System.Collections.Generic.List<global::Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik.IMakseRekvisiidid>();
                    if ((Reader.IsEmptyElement == false)) {
                        Reader.ReadStartElement("MakseRekvisiidid");
                        for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                                    && (Reader.LocalName == "item")); ) {
                            if ((Reader.IsElementNil() == false)) {
                                global::Xtee.Core.SerializationMetadata metaMakseRekvisiidid = this.GetMetaData<global::Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik.IMakseRekvisiidid>(Reader, "MakseRekvisiidid", "http://producers.etoimik.xtee.riik.ee/producer/etoimik");
                                global::Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik.IMakseRekvisiidid item = metaMakseRekvisiidid.NewEntity<global::Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik.IMakseRekvisiidid>();
                                clazz.MakseRekvisiidid.Add(item);
                                if ((Reader.IsEmptyElement == false)) {
                                    Reader.ReadStartElement("item");
                                    metaMakseRekvisiidid.NewSerializer(item).ReadXml(Reader);
                                    Reader.ReadEndElement();
                                }
                                else {
                                    Reader.Skip();
                                }
                            }
                            else {
                                clazz.MakseRekvisiidid.Add(null);
                                Reader.Skip();
                            }
                        }
                        Reader.ReadEndElement();
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    Reader.Skip();
                }
            }
        }
    }
}
